home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 November / Ahoy_Magazine_85-11_1985_Double_L.d64 / file scout v0619 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  5KB  |  189 lines

  1. 1 rem *********************************
  2. 2 rem *                               *
  3. 3 rem *     file scout v0619/85       *
  4. 4 rem *        (rv 0316/84)           *
  5. 5 rem *                               *
  6. 6 rem *********************************
  7. 7 rem
  8. 10 poke 53280,12:poke 53281,0 :print chr$(147)chr$(154);
  9. 16 h$="0123456789abcdef"
  10. 20 goto 1000
  11. 50 rem locate
  12. 51 poke 214,rw:poke 211,cl:sys 58640:return
  13. 60 rem set row, columns for scan
  14. 61 dim rw(35),cl(35)
  15. 62 for i=0 to 16:rw(i)=i+6:cl(i)=4:next i
  16. 63 for i=17 to 34:rw(i)=(i+6)-17:cl(i)=19:next i
  17. 65 return
  18. 99 :
  19. 100 rem ** collect all the active files and their first track & sectors **
  20. 101 rw=5:cl=6 :gosub 50:print "reading directory";
  21. 105 open 15,8,15,"u;"
  22. 110 n1=144:dim f$(n1),t(n1),s(n1),b(n1),ft$(n1)
  23. 115 open 2,8,2,"#2"
  24. 120 td=18:ts=1:nf=0
  25. 130 print#15,"u1:2,8,"td,ts
  26. 140 get#2,a$:td=asc(a$+chr$(0)):get#2,a$:ts=asc(a$+chr$(0))
  27. 145 for k=0 to 7
  28. 150 get#2,a$:if asc(a$+chr$(0))=0 then gosub 300:goto 230
  29. 151 a=asc(a$):if (a and 64)=0 then ft$(nf)="[160]":goto 153
  30. 152 ft$(nf)=">"
  31. 153 a=(a and(255-64))
  32. 155 if a=129 then ft$(nf)=ft$(nf)+"seq"
  33. 156 if a=130 then ft$(nf)=ft$(nf)+"prg"
  34. 157 if a=131 then ft$(nf)=ft$(nf)+"usr"
  35. 160 get#2,a$:get#2,b$:t(nf)=asc(a$+chr$(0)):s(nf)=asc(b$+chr$(0))
  36. 165 for j=0 to 15:get#2,a$
  37. 170 if a$=chr$(160) then goto 190
  38. 180 f$(nf)=f$(nf)+a$
  39. 190 next j
  40. 199 :
  41. 200 for j=0 to 8:get#2,a$:next j
  42. 210 get#2,a$:get#2,b$:b(nf)=asc(a$+chr$(0))+asc(b$+chr$(0))*256:ba=ba+b(nf)
  43. 224 nf=nf+1
  44. 225 get#2,a$:get#2,a$
  45. 230 next k
  46. 240 if td<>18 then goto 245
  47. 241 if ts<1 or ts>19 then goto 245
  48. 242 goto 130
  49. 245 if nf=0 then print"no files":end
  50. 246 close2:bf=664-ba:return
  51. 299 :
  52. 300 for j=0 to 30
  53. 310 get#2,a$:nextj
  54. 320 return
  55. 399 :
  56. 400 rem scan for t & s
  57. 405 rw=24:cl=1:gosub 50:print bl$;
  58. 410 rw=23:cl=2:gosub 50:f$="":k1=-1:print chr$(158);:input "file name";f$
  59. 411 if f$="" then rw=23:cl=1:print bl$;:return
  60. 412 ln=len(f$):if right$(f$,1)="*" then ln=len(f$)-1:f$=left$(f$,ln)
  61. 420 for k=0 to nf
  62. 422 if k1<>-1 then goto 430
  63. 425 if f$=left$(f$(k),ln) then k1=k
  64. 430 next k
  65. 431 ifk1=-1thenprint "    not found";:for k=0to2000:nextk:printchr$(154);:return
  66. 435 tr=t(k1):sc=s(k1)
  67. 440 bc=0:c=0:t4$="trk sec"
  68. 445 print#15,"i0:":close2: open 2,8,2,"#2"
  69. 450 print hd$;:rw=2:cl=1:gosub 50:print f$(k1);
  70. 455 rw=4:cl=6:gosub 50:print t4$;
  71. 460 rw=rw(c):cl=cl(c):gosub 50:print bc;tr;sc
  72. 465 gosub 590:if tr=0 then goto 480
  73. 470 bc=bc+1:c=c+1
  74. 475 if c<34 then goto 460
  75. 480 rw=24:cl=10:gosub 50:print chr$(5) "next  print  return ";
  76. 482 gosub 700:print a$chr$(158);
  77. 490 if a$="n" and bc<b(k1)-1 then c=0:goto 450
  78. 492 if a$="n" and bc=b(k1)-1 then goto 435
  79. 495 if a$="p" then gosub 500:goto 435
  80. 496 if a$="r" then close 2:print chr$(154);:return
  81. 497 goto 482
  82. 499 :
  83. 500 rem print out for t & s
  84. 505 open 4,4:bc=0
  85. 510 print#4,f$(k1)
  86. 515 tr=t(k1):sc=s(k1)
  87. 520 print#4,chr$(13)chr$(13)t4$chr$(13)chr$(13)
  88. 525 print#4,bc,tr,sc
  89. 530 gosub 590:bc=bc+1
  90. 535 if tr=0 then print#4:close4:return
  91. 540 goto 525
  92. 590 print#15,"u1:2,8",tr,sc
  93. 595 get#2,a$:tr=asc(a$+chr$(0))
  94. 596 get#2,a$:sc=asc(a$+chr$(0))
  95. 597 return
  96. 599 :
  97. 600 rem ** get load addr prg files **
  98. 605 dim la(n1),lh$(n1)
  99. 610 open 2,8,2,"#2"
  100. 620 for i=0 to nf-1
  101. 625 if right$(ft$(i),3)<>"prg" then la(i)=-1:goto 650
  102. 630 print#15,"u1:2,8,"t(i),s(i)
  103. 632 print#15,"b-p:"2,0
  104. 635 get#2,a$:get#2,a$:get#2,a$:get#2,b$
  105. 636 a=asc(a$+chr$(0)):b=asc(b$+chr$(0))
  106. 640 la(i)=a +b*256
  107. 641 bh=int(b/16):bl=b-(bh*16)
  108. 642 ah=int(a/16):al=a-(ah*16)
  109. 643 lh$(i)=mid$(h$,bh+1,1)+mid$(h$,bl+1,1)
  110. 644 lh$(i)="$"+lh$(i)+mid$(h$,ah+1,1)+mid$(h$,al+1,1)
  111. 650 next i
  112. 655 close 2:return
  113. 699 :
  114. 700 rem get char from kb, with cursor
  115. 705 poke 198,0:poke 204,0
  116. 710 get a$:poke 207,0:if a$="" then goto 710
  117. 715 poke 204,1:print " "chr$(157);:return
  118. 725 close15:open 15,8,15,"i0:"
  119. 730 input#15,a$,b$,c$,d$:close15
  120. 735 if a$="00" then return
  121. 740 print:print:print"disk error":stop
  122. 749 :
  123. 750 rem get disk name & id
  124. 760 open 15,8,15,"u;"
  125. 770 open 2,8,2,"#2"
  126. 775 td=18:ts=0:print#15,"u1:2,8,"td,ts
  127. 780 print#15,"m-r"chr$(144)chr$(5)chr$(20)
  128. 782 for i=0 to 19:get#15,a$:dn$=dn$+a$:next i
  129. 795 close2:close15:return
  130. 799 :
  131. 800 t1$=dn$+nf$
  132. 801 t2$="blocks alloc:[160]"+str$(ba)+" blocks free: "+str$(bf)+" "
  133. 802 t3$="file            type trk sec blk addr.d addr.h":s1$="     "
  134. 805 open 4,4:cmd 4
  135. 808 print s1$t1$:print s1$t2$:print:print s1$t3$:print
  136. 810 for k=0 to nf-1
  137. 820 print s1$f$(k);:for j=0to16-len(f$(k)):print" ";:next j:print ft$(k);
  138. 829 sp$="      "
  139. 830 a$=str$(t(k)):a$=a$+right$(sp$,3-len(a$))
  140. 831 b$=str$(s(k)):b$=b$+right$(sp$,3-len(b$))
  141. 832 c$=str$(b(k)):c$=c$+right$(sp$,4-len(c$))
  142. 840 print a$spc(1)b$spc(1)c$spc(1);:if la(k)<0 then print sp$;:goto 845
  143. 841 d$=str$(la(k)):d$=d$+right$(sp$,6-len(d$)):print d$spc(1)
  144. 845 print lh$(k)
  145. 850 next k
  146. 860 print#4,chr$(13):print#4:close4:return
  147. 899 :
  148. 1000 rem ** main routine **
  149. 1001 r0$=chr$(146):r9$=chr$(18):cl$=chr$(147)
  150. 1002 bl$="                                      "
  151. 1003 hd$=cl$+r9$+"           file scout v0619/85          "+r0$
  152. 1004 print hd$;:gosub 60
  153. 1005 rw=3:cl=1:gosub 50:print "insert disk and hit a key ";
  154. 1006 gosub 700:gosub 725:gosub 750
  155. 1010 gosub 100:gosub 600
  156. 1015 print
  157. 1400 nf$=str$(nf):l=len(nf$)
  158. 1401 fl$=right$(bl$,9-l)
  159. 1405 nf$= " # files : "+nf$+fl$
  160. 1410 th$=cl$+r9$+dn$+nf$
  161. 1501 sp$="         ":l=len(str$(ba))+len(str$(bf)):fl$=right$(sp$,14-l)
  162. 1502 tj$=r9$+"blocks alloc:"+str$(ba)+" blocks free:"+str$(bf)+fl$
  163. 1503 tl$=r9$+"file             type trk sec blk addr  "+r0$:i=0
  164. 1505 print th$;:print tj$:print tl$:print
  165. 1520 print f$(i);:for j=0to16-len(f$(i)):print" ";:next j:print ft$(i);
  166. 1529 sp$="      "
  167. 1530 a$=str$(t(i)):a$=a$+right$(sp$,3-len(a$))
  168. 1531 b$=str$(s(i)):b$=b$+right$(sp$,3-len(b$))
  169. 1532 c$=str$(b(i)):c$=c$+right$(sp$,4-len(c$))
  170. 1540 print a$spc(1)b$spc(1)c$;:if la(i)<0 then goto 1545
  171. 1541 print str$(la(i))
  172. 1545 print spc(34)lh$(i)
  173. 1546 i=i+1:if i=nf then goto 1548
  174. 1547 if i/8-int(i/8)<>0 then goto 1520
  175. 1548 rw=24:cl=5:gosub 50:print chr$(5)" next scout print boot quit?[160]";
  176. 1549 gosub 700:print a$;:print chr$(154);
  177. 1550 if a$="p" then gosub 800:print chr$(20);:goto 1548
  178. 1555 if a$="s" then gosub 400:goto 1580
  179. 1560 if a$="q" then stop
  180. 1565 if a$="b" then clr:goto 10
  181. 1570 if a$<>"n" then goto 1548
  182. 1575 if i<nf then goto 1505
  183. 1580 i=0:goto 1505
  184. 5999 :
  185. 6000 close15:open 15,8,15,"i0:":print#15,"s0:file scout v0619":close15
  186. 6005 save "file scout v0619",8:stop
  187. 6100 close15:open 15,8,15:input#15,a$,b$,c$,d$:close15
  188. 6101 print a$"[160]"b$"[160]"c$"[160]"d$:stop
  189.